home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / tcl / tcl67.lha / tcl6.7 / doc / GetInt.3 < prev    next >
Text File  |  1993-01-31  |  3KB  |  86 lines

  1. '\"
  2. '\" Copyright 1989 Regents of the University of California
  3. '\" Permission to use, copy, modify, and distribute this
  4. '\" documentation for any purpose and without fee is hereby
  5. '\" granted, provided that this notice appears in all copies.
  6. '\" The University of California makes no representations about
  7. '\" the suitability of this material for any purpose.  It is
  8. '\" provided "as is" without express or implied warranty.
  9. '\" 
  10. '\" $Header: /user6/ouster/tcl/man/RCS/GetInt.3,v 1.6 93/01/31 15:35:35 ouster Exp $ SPRITE (Berkeley)
  11. '\" 
  12. .so man.macros
  13. .HS Tcl_GetInt tcl
  14. .BS
  15. .SH NAME
  16. Tcl_GetInt, Tcl_GetDouble, Tcl_GetBoolean \- convert from string to integer, double, or boolean
  17. .SH SYNOPSIS
  18. .nf
  19. \fB#include <tcl.h>\fR
  20. .sp
  21. int
  22. \fBTcl_GetInt\fR(\fIinterp, string, intPtr\fR)
  23. .sp
  24. int
  25. \fBTcl_GetDouble\fR(\fIinterp, string, doublePtr\fR)
  26. .sp
  27. int
  28. \fBTcl_GetBoolean\fR(\fIinterp, string, boolPtr\fR)
  29. .SH ARGUMENTS
  30. .AS Tcl_Interp *doublePtr
  31. .AP Tcl_Interp *interp in
  32. Interpreter to use for error reporting.
  33. .AP char *string in
  34. Textual value to be converted.
  35. .AP int *intPtr out
  36. Points to place to store integer value converted from \fIstring\fR.
  37. .AP double *doublePtr out
  38. Points to place to store double-precision floating-point
  39. value converted from \fIstring\fR.
  40. .AP int *boolPtr out
  41. Points to place to store boolean value (0 or 1) converted from \fIstring\fR.
  42. .BE
  43.  
  44. .SH DESCRIPTION
  45. .PP
  46. These procedures convert from strings to integers or double-precision
  47. floating-point values or booleans (represented as 0- or 1-valued
  48. integers).  Each of the procedures takes a \fIstring\fR argument,
  49. converts it to an internal form of a particular type, and stores
  50. the converted value at the location indicated by the procedure's
  51. third argument.  If all goes well, each of the procedures returns
  52. TCL_OK.  If \fIstring\fR doesn't have the proper syntax for the
  53. desired type then TCL_ERROR is returned, an error message is left
  54. in \fIinterp->result\fR, and nothing is stored at *\fIintPtr\fR
  55. or *\fIdoublePtr\fR or *\fIboolPtr\fR.
  56. .PP
  57. \fBTcl_GetInt\fR expects \fIstring\fR to consist of a collection
  58. of integer digits, optionally signed and optionally preceded by
  59. white space.  If the first two characters of \fIstring\fR are ``0x''
  60. then \fIstring\fR is expected to be in hexadecimal form;  otherwise,
  61. if the first character of \fIstring\fR is ``0'' then \fIstring\fR
  62. is expected to be in octal form;  otherwise, \fIstring\fR is
  63. expected to be in decimal form.
  64. .PP
  65. \fBTcl_GetDouble\fR expects \fIstring\fR to consist of a floating-point
  66. number, which is:  white space;  a sign; a sequence of digits;  a
  67. decimal point;  a sequence of digits;  the letter ``e'';  and a
  68. signed decimal exponent.  Any of the fields may be omitted, except that
  69. the digits either before or after the decimal point must be present
  70. and if the ``e'' is present then it must be followed by the
  71. exponent number.
  72. .PP
  73. \fBTcl_GetBoolean\fR expects \fIstring\fR to specify a boolean
  74. value.  If \fIstring\fR is any of \fB0\fR, \fBfalse\fR,
  75. .VS
  76. \fBno\fR, or \fBoff\fR, then \fBTcl_GetBoolean\fR stores a zero
  77. value at \fI*boolPtr\fR.
  78. If \fIstring\fR is any of \fB1\fR, \fBtrue\fR, \fByes\fR, or \fBon\fR,
  79. .VE
  80. then 1 is stored at \fI*boolPtr\fR.
  81. Any of these values may be abbreviated, and upper-case spellings
  82. are also acceptable.
  83.  
  84. .SH KEYWORDS
  85. boolean, conversion, double, floating-point, integer
  86.